package org.example.state;

import lombok.AllArgsConstructor;

import java.util.Arrays;
import java.util.Optional;

@AllArgsConstructor
public enum StateEnum {
    EYE(GirlEyeState.instance(),GirlNoseState.instance()),
    NOSE(GirlNoseState.instance(),GirlMouthState.instance());
    public final GirlState preState;
    public final GirlState nextState;
    public static GirlState getNextState(GirlState girlState){
        Optional<StateEnum> first = Arrays.stream(StateEnum.values()).filter(t -> girlState.getClass().equals(t.preState.getClass())).findFirst();
        if(first.isPresent()){
            return first.get().nextState;
        }else{
            return GirlMouthState.instance();
        }
    }
}
